package com.example.campusannouncement;

import org.slf4j.Logger; // 使用 SLF4J 日志接口
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@EnableFeignClients
public class CampusAnnouncementApplication extends SpringBootServletInitializer {

    // 使用 SLF4J 的 LoggerFactory 获取 Logger
    private static final Logger logger = LoggerFactory.getLogger(CampusAnnouncementApplication.class);

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(CampusAnnouncementApplication.class);
    }

    public static void main(String[] args) {
        // 先启动应用，再记录日志（避免静态初始化时未初始化日志系统）
        SpringApplication.run(CampusAnnouncementApplication.class, args);
        logger.info("校园公告系统启动成功！");
        logger.info("请访问: http://localhost:8080/announcements");
    }
}
